<%--
  Created by IntelliJ IDEA.
  User: YYY
  Date: 2017/7/16
  Time: 13:40
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path;
%>
<!DOCTYPE>
<html>
<head>
    <title>音频专题列表</title>
    <meta charset="UTF-8">
    <title>AdminLTE | Data Tables</title>
    <meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>

    <!-- start分页需要使用以下三个js -->
    <script type="text/javascript" src="<%=basePath%>/js/jquery-2.1.1.min.js"></script>
    <script type="text/javascript" src="<%=basePath%>/js/admin/utils.js"></script>
    <script type="text/javascript" src="<%=basePath%>/js/base/listtable.js"></script>
    <!-- end分页需要使用以上三个js -->

    <style type="text/css">
        .table th, .table td {
            text-align: center;
            vertical-align: middle!important;
        }
    </style>
</head>
<body class="skin-blue">

<!-- header logo: style can be found in header.less -->


<!-- getHeader -->
<s:action name="getHeader" namespace="/privilege" executeResult="true"/>
<div class="wrapper row-offcanvas row-offcanvas-left">
    <!-- Left side column. contains the logo and sidebar -->

    <!-- getMenus -->
    <s:action name="getMenus" namespace="/privilege" executeResult="true"/>

    <!-- Right side column. Contains the navbar and content of the page -->
    <aside class="right-side">
        <!-- Content Header (Page header) -->
        <section class="content-header">
            <h1>
                <small>音频专题管理</small>
            </h1>
        </section>

        <!-- Main content -->
        <section class="content">
            <div class="row">
                <div class="col-xs-12">
                    <div class="box">

                        <div class="box box-danger">

                            <div class="box-body">

                                <form action="javascript:searchVoiceSubject();" class="form-horizontal" name="searchForm">

                                    <div class="form-group">
                                        <lable style="float: left;margin-left: 30px">频道名称</lable>
                                        <input type="text" id="dataName" class="col-sm-2" style="float: left;margin-left: 30px">
                                        <lable style="float: left;margin-left: 30px">主讲人</lable>
                                        <input type="text" id="stuffName" class="input-small col-sm-2" style="float: left;margin-left: 30px">

                                        <button type="submit" class="btn btn-primary" style="margin-left: 15px">查询</button>
                                        <a href="<%=basePath%>/voice/addVoiceSubject.action" style="margin-left: 15px">
                                            <button type="button" class="btn btn-success">新增</button>
                                        </a>
                                    </div>

                                    <div class="form-group">
                                        <lable style="float: left;margin-left: 30px">是否免费</lable>
                                        <div class="col-sm-2" style="margin-left: 30px;padding: 0">
                                            <select class="form-control" id="freetype" name="freetype">
                                                <option value="">全部</option>
                                                <option value="0">免费</option>
                                                <option value="1">会员专享</option>
                                            </select>
                                        </div>
                                    </div>
                                </form>
                            </div><!-- /.box-body -->
                        </div><!-- /.box -->
                        <!-- 文章列表 -->
                        <form method="post" target="_self" action="" name="listForm">
                            <div class="box-body table-responsive" id="listDiv">

                                <s:property value="res" escape="false"/>
                            </div><!-- /.box-body -->
                        </form>

                    </div><!-- /.box -->


                </div>
            </div>

        </section><!-- /.content -->
    </aside><!-- /.right-side -->
</div><!-- ./wrapper -->

<div class="modal fade" id="deleteAlertModal" tabindex="-1" role="dialog" aria-labelledby="messageModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <h4 class="modal-title">
                    操作提示
                </h4>
            </div>
            <div class="modal-body">
                <div>
                    <label id="d_dataName"></label>
                </div>
                <label id="d_rec_id" style="display: none">哈哈</label>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-danger" onclick="deleteVoiceSubject()" data-dismiss="modal">确定
                </button>
                <button type="button" class="btn btn-primary" data-dismiss="modal">取消
                </button>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal -->
</div>

</body>

<script type="text/javascript">

    function searchVoiceSubject() {

        var dataName = Utils.trim($("#dataName").val());
        var stuffName = Utils.trim($("#stuffName").val());
        var freetype = Utils.trim($("#freetype").val());

        listTable.filter['dataName'] = dataName;
        listTable.filter['stuffName'] = stuffName;
        listTable.filter['freetype'] = freetype;
        listTable.filter['currentPage'] = 1;
        listTable.action = "<%=basePath%>/voice/ajaxQueryVoiceSubjectList.action";

        listTable.loadList();
    }
    
    function deleteVoiceSubject() {

        var rec_id= $("#d_rec_id").html();
        $.ajax({
            type: "POST",
            url:"<%=basePath%>/voice/ajaxDeleteVoiceSubject.action",
            data:"recid="+rec_id,
            async: false,
            error: function(request) {
                alert("网络异常");
            },
            success: function(data) {
                alert("修改成功");
            }
        });

    }

    function showDeleteAlert(recid,dataName) {

        $("#d_rec_id").html(recid);
        if (Utils.isEmail(dataName))
        {
            $("#d_dataName").html("你要删除该音频专题吗？");
        }else
        {
            $("#d_dataName").html("你要删除"+dataName+"音频专题吗？");
        }
        $('#deleteAlertModal').modal('show');
    }
    $(document).ready(new function () {
        searchVoiceSubject();
    })

</script>
</html>
